import 'package:flutter/material.dart';

class sampleContainer extends StatelessWidget {
  const sampleContainer();

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        backgroundColor: Colors.white,
        elevation: 0.0,
        title: new Text(
          "发布成功",
          style: new TextStyle(
            color: Colors.black,
            fontSize: 18.0,
            fontWeight: FontWeight.normal,
          ),
        ),
        leading: IconButton(
            icon: new Image.asset("images/nav_close.png", fit: BoxFit.cover),
            onPressed: () {
              Navigator.maybePop(context);
            }),
      ),
      body: new SamplePageContent(),
    );
  }
}

class SamplePageContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Container(
      width: 100,
      padding: const EdgeInsets.all(20.0),
      child: new Column(
        children: <Widget>[
          new Column(
            children: <Widget>[
              new Container(
                  decoration: new BoxDecoration(
                    color: Colors.black38,
                    border: new Border.all(width: 10.0, color: Colors.black38),
                    borderRadius:
                        const BorderRadius.all(const Radius.circular(8.0)),
                  ),
                  alignment: Alignment.topLeft,
                  margin: const EdgeInsets.all(16.0),
                  child: new Column(
                    children: <Widget>[
                      Text('Flutter Row', style: TextStyle(color: Colors.red)),
                    ],
                  )),
              new Container(
                  alignment: Alignment.centerRight,
                  margin: const EdgeInsets.all(16.0),
                  child: new Row(children: <Widget>[
                    Expanded(child: Text('sssssssssss')),
                    Expanded(
                        child: _getContainer(
                            'https://raw.githubusercontent.com/think-ing/flutter_demo/master/images/a.jpg',
                            'ssssssss')),
                    Expanded(
                        child: _getContainer(
                            'https://raw.githubusercontent.com/think-ing/flutter_demo/master/images/a.jpg',
                            'sss')),
                  ])),
              new Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  new Container(
                    color: Colors.red,
                    width: 100,
                    height: 100,
                  ),
                  new Container(
                    alignment: Alignment.topCenter,
                    color: Colors.red,
                    width: 100,
                    height: 100,
                    child: new Column(children: <Widget>[
                      Expanded(child: Text('sssssssssss')),
                      Expanded(
                          child: _getContainer(
                              'https://raw.githubusercontent.com/think-ing/flutter_demo/master/images/a.jpg',
                              'sss')),
                      RawImage(
                        color: Colors.green,
                        width: 40,
                        height: 40,
                        fit: BoxFit.cover,
                      ),
                    ]),
                  ),
                ],
              ),
              new Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  new Container(
                    margin: const EdgeInsets.all(16.0),
                    alignment: Alignment.center,
                    color: Colors.red,
                    width: 100,
                    height: 100,
                  ),
                  new Container(
                    margin: const EdgeInsets.all(16.0),
                    alignment: Alignment.centerRight,
                    color: Colors.red,
                    width: 100,
                    height: 100,
                    child: new Column(children: <Widget>[
                      Expanded(child: Text('sssssssssss')),
                    ]),
                  ),
                ],
              ),
              new Container(
                constraints: new BoxConstraints.expand(
                  height: Theme.of(context).textTheme.display1.fontSize * 1.1 +
                      200.0,
                ),
                decoration: new BoxDecoration(
                  border: new Border.all(width: 2.0, color: Colors.red),
                  color: Colors.grey,
                  borderRadius: new BorderRadius.all(new Radius.circular(20.0)),
                  image: new DecorationImage(
                    image: new NetworkImage(
                        'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
                    centerSlice: new Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
                  ),
                ),
                padding: const EdgeInsets.all(8.0),
                alignment: Alignment.center,
                child: new Text('Hello World',
                    style: Theme.of(context)
                        .textTheme
                        .display1
                        .copyWith(color: Colors.black)),
                transform: new Matrix4.rotationZ(0.3),
              )
            ],
          ),
        ],
      ),
    );
  }
}

/**
 * 抽取item项
 */
Widget _getContainer(imgUrl, String test) {
  return new Container(
      //      ListTile
      child: new ListTile(
    leading: Image.network(imgUrl),
    title: new Text(test),
    subtitle: new Text("我是subtitle"),
  ));
}
